﻿@using HopNguyenModel
@model TypeContent
@{
    var lstContent = new Content().GetAllChildByType(Model != null ? Model.Alias : "").OrderByDescending(a => a.Id);
    var page = Request.QueryString["p"] != null ? Convert.ToInt32(Request.QueryString["p"]) : 1;

    const int itemPerPage = 8;
    var pagingCount = Convert.ToInt32(Math.Ceiling((lstContent.Count() / (float)itemPerPage)));
    var listPaging = lstContent.Skip((page - 1) * itemPerPage).Take(itemPerPage);
    var url = Request.RawUrl.Split('?')[0];
}

<div class="box-big">
    <div class="box-big-top">
        <h3 style="color: #cc1a20">@Model.Name</h3>
    </div>
    <div class="box-big-bg" style="border-top: 1px solid #dfdfdf">
        <div class="text-box-big">
            @foreach (var item in listPaging)
            {
                <div class="news-item">
                    <div class="img-news">
                        <a href="/@item.TypeContent.Alias/@(item.Alias).html" title="@item.Name">
                            <img src="@(!string.IsNullOrEmpty(item.Image) ? item.Image : "/frontend/img/no-image.gif")" alt="@item.Name" />
                        </a>
                    </div>
                    <div class="intro-news">
                        <h1 class="title-intro-news">
                            <a href="/@item.TypeContent.Alias/@(item.Alias).html" title="@item.Name">@item.Name</a>
                        </h1>
                        @item.Summary
                    </div>
                </div>
            }
        </div>
        @if (pagingCount > 1)
        {
            @RenderPage("~/Views/Shared/Patial/General/_Pagination.cshtml", pagingCount, page, url)
        }
    </div>
</div>
